perfc_arrays?= n
crash_debug ?= n
+# Hardcoded configuration implications and dependencies.
+# Do this is a neater way if it becomes unwieldy.
+ifeq ($(debug),y)
+verbose := y
+endif
+ifeq ($(perfc_arrays),y)
+perfc := y
+endif
+
XEN_ROOT=$(BASEDIR)/..
include $(XEN_ROOT)/Config.mk
OBJS := $(patsubst %.S,%.o,$(S_SRCS))
OBJS += $(patsubst %.c,%.o,$(C_SRCS))
-# Note that link order matters!
-ALL_OBJS := $(BASEDIR)/common/common.o
-ALL_OBJS += $(BASEDIR)/drivers/char/driver.o
-ALL_OBJS += $(BASEDIR)/drivers/acpi/driver.o
-ifeq ($(ACM_SECURITY),y)
-ALL_OBJS += $(BASEDIR)/acm/acm.o
-CFLAGS += -DACM_SECURITY
-endif
-ALL_OBJS += $(BASEDIR)/arch/$(TARGET_ARCH)/arch.o
+ALL_OBJS-y :=
+CFLAGS-y :=
+subdirs-y :=
+subdirs-n :=
include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk
-CFLAGS += -g -D__XEN__
-
-ifneq ($(debug)$(verbose),nn)
-CFLAGS += -DVERBOSE
-endif
-
-ifeq ($(crash_debug),y)
-CFLAGS += -DCRASH_DEBUG
-endif
+# Note that link order matters!
+ALL_OBJS-y += $(BASEDIR)/common/common.o
+ALL_OBJS-y += $(BASEDIR)/drivers/char/driver.o
+ALL_OBJS-$(HAS_ACPI) += $(BASEDIR)/drivers/acpi/driver.o
+ALL_OBJS-$(ACM_SECURITY) += $(BASEDIR)/acm/acm.o
+ALL_OBJS-y += $(BASEDIR)/arch/$(TARGET_ARCH)/arch.o
-ifeq ($(perfc),y)
-CFLAGS += -DPERF_COUNTERS
-ifeq ($(perfc_arrays),y)
-CFLAGS += -DPERF_ARRAYS
-endif
-endif
+CFLAGS-y += -g -D__XEN__
+CFLAGS-$(ACM_SECURITY) += -DACM_SECURITY
+CFLAGS-$(verbose) += -DVERBOSE
+CFLAGS-$(crash_debug) += -DCRASH_DEBUG
+CFLAGS-$(perfc) += -DPERF_COUNTERS
+CFLAGS-$(perfc_arrays) += -DPERF_ARRAYS
-CFLAGS := $(strip $(CFLAGS))
+ALL_OBJS := $(ALL_OBJS-y)
+CFLAGS := $(strip $(CFLAGS) $(CFLAGS-y))
%.o: %.c $(HDRS) Makefile
$(CC) $(CFLAGS) -c $< -o $@